<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>octant.ocean.depths</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="octant-module.html">Package&nbsp;octant</a> ::
        <a href="octant.ocean-module.html">Package&nbsp;ocean</a> ::
        Module&nbsp;depths
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="octant.ocean.depths-module.html">Module octant.ocean.depths</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># encoding: utf-8</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-docstring">"""</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"><tt class="py-docstring">depths.py</tt> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-docstring">Created by Rob Hetland on 2007-03-30.</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-docstring">Copyright (c) 2007 Texas A&amp;M Univsersity. All rights reserved.</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-docstring">Release under MIT license.</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">pyroms</tt> <tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Function octant.io.Dataset()=octant.io-module.html#Dataset"><a title="octant.io.Dataset" class="py-name" href="#" onclick="return doclink('link-0', 'Dataset', 'link-0');">Dataset</a></tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"> </tt>
<a name="Depths"></a><div id="Depths-def"><a name="L14"></a><tt class="py-lineno">14</tt> <a class="py-toggle" href="#" id="Depths-toggle" onclick="return toggle('Depths');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="octant.ocean.depths.Depths-class.html">Depths</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Depths-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="Depths-expanded"><a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line">    <tt class="py-docstring">"""docstring for Depths"""</tt> </tt>
<a name="Depths.__init__"></a><div id="Depths.__init__-def"><a name="L16"></a><tt class="py-lineno">16</tt> <a class="py-toggle" href="#" id="Depths.__init__-toggle" onclick="return toggle('Depths.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.ocean.depths.Depths-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">hc</tt><tt class="py-op">,</tt> <tt class="py-param">h</tt><tt class="py-op">,</tt> <tt class="py-param">theta_b</tt><tt class="py-op">,</tt> <tt class="py-param">theta_s</tt><tt class="py-op">,</tt> <tt class="py-param">N</tt><tt class="py-op">,</tt> <tt class="py-param">grid</tt><tt class="py-op">=</tt><tt class="py-string">'rho'</tt><tt class="py-op">,</tt> <tt class="py-param">zeta</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Depths.__init__-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="Depths.__init__-expanded"><a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">hc</tt> <tt class="py-op">=</tt> <tt class="py-name">hc</tt> </tt>
<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt> <tt class="py-op">=</tt> <tt class="py-name">h</tt> </tt>
<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt> <tt class="py-op">=</tt> <tt class="py-name">theta_b</tt> </tt>
<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt> <tt class="py-op">=</tt> <tt class="py-name">theta_s</tt> </tt>
<a name="L21"></a><tt class="py-lineno">21</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt>
<a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module octant.grid=octant.grid-module.html"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-1', 'grid', 'link-1');">grid</a></tt> <tt class="py-op">=</tt> <tt id="link-2" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-2', 'grid', 'link-1');">grid</a></tt> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line">         </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-3', 'grid', 'link-1');">grid</a></tt> <tt class="py-op">==</tt> <tt class="py-string">'w'</tt><tt class="py-op">:</tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line">         </tt>
<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">zeta</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">zeros</tt><tt class="py-op">(</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line">         </tt>
<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line">        <tt class="py-name">hdim</tt> <tt class="py-op">=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">shape</tt><tt class="py-op">(</tt><tt class="py-name">h</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"> </tt>
<a name="Depths._get_sc"></a><div id="Depths._get_sc-def"><a name="L34"></a><tt class="py-lineno">34</tt> <a class="py-toggle" href="#" id="Depths._get_sc-toggle" onclick="return toggle('Depths._get_sc');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.ocean.depths.Depths-class.html#_get_sc">_get_sc</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Depths._get_sc-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="Depths._get_sc-expanded"><a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-4', 'grid', 'link-1');">grid</a></tt> <tt class="py-op">==</tt> <tt class="py-string">'rho'</tt><tt class="py-op">:</tt> </tt>
<a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line">            <tt id="link-5" class="py-name" targets="Variable octant.depths.s_coordinate.sc=octant.depths.s_coordinate-class.html#sc,Variable octant.ocean.depths.Depths.sc=octant.ocean.depths.Depths-class.html#sc"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-5', 'sc', 'link-5');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">linspace</tt><tt class="py-op">(</tt><tt class="py-op">-</tt><tt class="py-number">1.0</tt><tt class="py-op">,</tt> <tt class="py-number">0.0</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">+</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line">            <tt id="link-6" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-6', 'sc', 'link-5');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt id="link-7" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-7', 'sc', 'link-5');">sc</a></tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">+</tt><tt id="link-8" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-8', 'sc', 'link-5');">sc</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line">            <tt id="link-9" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-9', 'sc', 'link-5');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">linspace</tt><tt class="py-op">(</tt><tt class="py-op">-</tt><tt class="py-number">1.0</tt><tt class="py-op">,</tt> <tt class="py-number">0.0</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt>
<a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-10" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-10', 'sc', 'link-5');">sc</a></tt> </tt>
</div><a name="L41"></a><tt class="py-lineno">41</tt>  <tt class="py-line">     </tt>
<a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line">    <tt id="link-11" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-11', 'sc', 'link-5');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name" targets="Method octant.depths.s_coordinate._get_sc()=octant.depths.s_coordinate-class.html#_get_sc,Method octant.ocean.depths.Depths._get_sc()=octant.ocean.depths.Depths-class.html#_get_sc"><a title="octant.depths.s_coordinate._get_sc
octant.ocean.depths.Depths._get_sc" class="py-name" href="#" onclick="return doclink('link-12', '_get_sc', 'link-12');">_get_sc</a></tt><tt class="py-op">)</tt> </tt>
<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line">     </tt>
<a name="Depths._get_Cs"></a><div id="Depths._get_Cs-def"><a name="L44"></a><tt class="py-lineno">44</tt> <a class="py-toggle" href="#" id="Depths._get_Cs-toggle" onclick="return toggle('Depths._get_Cs');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.ocean.depths.Depths-class.html#_get_Cs">_get_Cs</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Depths._get_Cs-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="Depths._get_Cs-expanded"><a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt id="link-13" class="py-name" targets="Variable octant.ocean.depths.sinh=octant.ocean.depths-module.html#sinh,Variable octant.ocean.sinh=octant.ocean-module.html#sinh,Variable octant.ocean.state.sinh=octant.ocean.state-module.html#sinh,Variable octant.ocean.step3d_t.sinh=octant.ocean.step3d_t-module.html#sinh,Variable octant.ocean.time.sinh=octant.ocean.time-module.html#sinh,Variable octant.ocean.velocity.sinh=octant.ocean.velocity-module.html#sinh"><a title="octant.ocean.depths.sinh
octant.ocean.sinh
octant.ocean.state.sinh
octant.ocean.step3d_t.sinh
octant.ocean.time.sinh
octant.ocean.velocity.sinh" class="py-name" href="#" onclick="return doclink('link-13', 'sinh', 'link-13');">sinh</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-14', 'sc', 'link-5');">sc</a></tt><tt class="py-op">)</tt><tt class="py-op">/</tt><tt id="link-15" class="py-name"><a title="octant.ocean.depths.sinh
octant.ocean.sinh
octant.ocean.state.sinh
octant.ocean.step3d_t.sinh
octant.ocean.time.sinh
octant.ocean.velocity.sinh" class="py-name" href="#" onclick="return doclink('link-15', 'sinh', 'link-13');">sinh</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">)</tt> \ </tt>
<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line">                <tt class="py-op">+</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt id="link-16" class="py-name" targets="Variable octant.ocean.depths.tanh=octant.ocean.depths-module.html#tanh,Variable octant.ocean.state.tanh=octant.ocean.state-module.html#tanh,Variable octant.ocean.step3d_t.tanh=octant.ocean.step3d_t-module.html#tanh,Variable octant.ocean.tanh=octant.ocean-module.html#tanh,Variable octant.ocean.time.tanh=octant.ocean.time-module.html#tanh,Variable octant.ocean.velocity.tanh=octant.ocean.velocity-module.html#tanh"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-16', 'tanh', 'link-16');">tanh</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-17', 'sc', 'link-5');">sc</a></tt><tt class="py-op">+</tt><tt class="py-number">0.5</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">-</tt><tt id="link-18" class="py-name"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-18', 'tanh', 'link-16');">tanh</a></tt><tt class="py-op">(</tt><tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line">                  <tt class="py-op">/</tt><tt id="link-19" class="py-name"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-19', 'tanh', 'link-16');">tanh</a></tt><tt class="py-op">(</tt><tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">)</tt> </tt>
</div><a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line">     </tt>
<a name="L49"></a><tt class="py-lineno">49</tt>  <tt class="py-line">    <tt id="link-20" class="py-name" targets="Variable octant.depths.s_coordinate.Cs=octant.depths.s_coordinate-class.html#Cs,Variable octant.ocean.depths.Depths.Cs=octant.ocean.depths.Depths-class.html#Cs"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-20', 'Cs', 'link-20');">Cs</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-21" class="py-name" targets="Method octant.depths.s_coordinate._get_Cs()=octant.depths.s_coordinate-class.html#_get_Cs,Method octant.ocean.depths.Depths._get_Cs()=octant.ocean.depths.Depths-class.html#_get_Cs"><a title="octant.depths.s_coordinate._get_Cs
octant.ocean.depths.Depths._get_Cs" class="py-name" href="#" onclick="return doclink('link-21', '_get_Cs', 'link-21');">_get_Cs</a></tt><tt class="py-op">)</tt> </tt>
<a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line">     </tt>
<a name="Depths.__getitem__"></a><div id="Depths.__getitem__-def"><a name="L51"></a><tt class="py-lineno">51</tt> <a class="py-toggle" href="#" id="Depths.__getitem__-toggle" onclick="return toggle('Depths.__getitem__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.ocean.depths.Depths-class.html#__getitem__">__getitem__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Depths.__getitem__-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="Depths.__getitem__-expanded"><a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">tuple</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">]</tt> </tt>
<a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-22" class="py-name" targets="Module octant.slice=octant.slice-module.html"><a title="octant.slice" class="py-name" href="#" onclick="return doclink('link-22', 'slice', 'link-22');">slice</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">key</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L55"></a><tt class="py-lineno">55</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> </tt>
<a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt id="link-23" class="py-name"><a title="octant.slice" class="py-name" href="#" onclick="return doclink('link-23', 'slice', 'link-22');">slice</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> </tt>
<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt class="py-name">key</tt> </tt>
<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line">         </tt>
<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>       <tt class="py-comment"># Assure a time-dimension exists</tt> </tt>
<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt id="link-24" class="py-name" targets="Variable octant.ocean.depths.newaxis=octant.ocean.depths-module.html#newaxis,Variable octant.ocean.newaxis=octant.ocean-module.html#newaxis,Variable octant.ocean.state.newaxis=octant.ocean.state-module.html#newaxis,Variable octant.ocean.step3d_t.newaxis=octant.ocean.step3d_t-module.html#newaxis,Variable octant.ocean.time.newaxis=octant.ocean.time-module.html#newaxis,Variable octant.ocean.velocity.newaxis=octant.ocean.velocity-module.html#newaxis"><a title="octant.ocean.depths.newaxis
octant.ocean.newaxis
octant.ocean.state.newaxis
octant.ocean.step3d_t.newaxis
octant.ocean.time.newaxis
octant.ocean.velocity.newaxis" class="py-name" href="#" onclick="return doclink('link-24', 'newaxis', 'link-24');">newaxis</a></tt><tt class="py-op">,</tt> <tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line">         </tt>
<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line">        <tt class="py-name">ti</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line">        <tt class="py-name">z</tt> <tt class="py-op">=</tt> <tt class="py-name">empty</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ti</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">,</tt> <tt class="py-string">'d'</tt><tt class="py-op">)</tt> </tt>
<a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">ti</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt>  <tt class="py-name">k</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line">                <tt class="py-name">z0</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-25', 'sc', 'link-5');">sc</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-26', 'Cs', 'link-20');">Cs</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">hc</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-27', 'Cs', 'link-20');">Cs</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">;</tt> </tt>
<a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line">                <tt class="py-name">z</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">,</tt><tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">z0</tt> <tt class="py-op">+</tt> <tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-number">1.0</tt> <tt class="py-op">+</tt> <tt class="py-name">z0</tt><tt class="py-op">/</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> </tt>
<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line">         </tt>
<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">squeeze</tt><tt class="py-op">(</tt><tt class="py-name">z</tt><tt class="py-op">[</tt><tt class="py-name">res_index</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line">     </tt>
<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line"> </tt>
<a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line">    <tt class="py-name">nc</tt> <tt class="py-op">=</tt> <tt id="link-28" class="py-name"><a title="octant.io.Dataset" class="py-name" href="#" onclick="return doclink('link-28', 'Dataset', 'link-0');">Dataset</a></tt><tt class="py-op">(</tt><tt class="py-string">'/Users/rob/foo/roms-2.2/ocean_his.nc'</tt><tt class="py-op">)</tt> </tt>
<a name="L77"></a><tt class="py-lineno">77</tt>  <tt class="py-line">    <tt class="py-name">z_r</tt> <tt class="py-op">=</tt> <tt id="link-29" class="py-name" targets="Class octant.roms.nc_depths=octant.roms.nc_depths-class.html"><a title="octant.roms.nc_depths" class="py-name" href="#" onclick="return doclink('link-29', 'nc_depths', 'link-29');">nc_depths</a></tt><tt class="py-op">(</tt><tt class="py-name">nc</tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno">78</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">z_r</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-30', 'sc', 'link-5');">sc</a></tt> </tt>
<a name="L79"></a><tt class="py-lineno">79</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">z_r</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> </tt>
<a name="L80"></a><tt class="py-lineno">80</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'z_r.shape = '</tt><tt class="py-op">,</tt> <tt class="py-name">z_r</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">50</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt> </tt>
<a name="L81"></a><tt class="py-lineno">81</tt>  <tt class="py-line">    <tt class="py-name">z_w</tt> <tt class="py-op">=</tt> <tt id="link-31" class="py-name"><a title="octant.roms.nc_depths" class="py-name" href="#" onclick="return doclink('link-31', 'nc_depths', 'link-29');">nc_depths</a></tt><tt class="py-op">(</tt><tt class="py-name">nc</tt><tt class="py-op">,</tt> <tt class="py-string">'w'</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno">82</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">z_w</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-32', 'Cs', 'link-20');">Cs</a></tt> </tt>
<a name="L83"></a><tt class="py-lineno">83</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">z_w</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> </tt>
<a name="L84"></a><tt class="py-lineno">84</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'z_w.shape = '</tt><tt class="py-op">,</tt> <tt class="py-name">z_w</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">50</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt> </tt>
<a name="L85"></a><tt class="py-lineno">85</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Mon Apr 20 11:56:31 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
